package bjh.controller;

import bjh.service.ClarwerService;
import bjh.service.WeatherService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wenchang
 * @create 2020-10-30-23:06
 */
@RestController
public class WeatherController {
    @Autowired
    ClarwerService clarwerService;
    @Autowired
    WeatherService weatherService;

    @GetMapping("/wea")
    public JSONObject getWea(){
        try {
            return clarwerService.hourlyNew("106566");
        } catch (Exception e) {
            return null;
        }
    }

    @GetMapping("/get")
    public JSONObject get(){
        return weatherService.getg();
    }
}
